import os
from django.conf.urls.defaults import patterns, include, url
from fromBook.views import *
from django.views.generic.simple import direct_to_template

site_media = os.path.join(os.path.dirname(__file__), 'site_media')


# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # browsing
    ('^$',main_page),
    (r'^user/(\w+)/$', user_page),
    (r'^tag/([^\s]+)/$', tag_page),
    (r'^tag/$', tag_cloud_page),
    (r'^search/$', search_page),

    #session management
    (r'^login/$', 'django.contrib.auth.views.login'),
    (r'^logout/$', logout_page),
    (r'^register/$', register_page),
    (r'^register_success/$', direct_to_template, {'template': 'registration/register_success.html'}),

    #site media
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': site_media}),

    #account management
    (r'^save/$', bookmark_save_page),

    #ajax
    (r'^ajax/tag/autocomplete/$', ajax_tag_autocomplete),
    
    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # url(r'^admin/', include(admin.site.urls)),
)
